// Setpass.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"


#define DEFAULT_USER L"Admin"
#define DEFAULT_NEW_PASS L"Admin"

int _tmain(int argc, TCHAR *argv[], TCHAR *envp[])
{
	TCHAR user[MAX_PATH];
	TCHAR pwd[MAX_PATH];

	RETAILMSG(1, (L"Setpass started."));

	Sleep(5000);

	wcscpy_s(user, MAX_PATH, DEFAULT_USER);
	wcscpy_s(pwd, MAX_PATH, DEFAULT_NEW_PASS);

	if (argc == 2)
	{
		//If one parameter then it's the password for the default user, Admin
		wcscpy_s(pwd, MAX_PATH, argv[1]);
	}
	else if (argc == 3)
	{
		//If two parameters then first is user, from Telent and FTP user lists (same) (should verify that) and second is password.
		wcscpy_s(user, MAX_PATH,argv[1]);
		wcscpy_s(pwd, MAX_PATH, argv[2]);
	}

	BOOL bRet = NTLMSetUserInfo(user, pwd);

	if (bRet == FALSE)
		RETAILMSG(1, (L"Failed to set user info"));
	else
		RETAILMSG(1, (L"User info updated"));
    return 0;
}
